﻿@model ArticleTagModel
@{
    var gridPageSize = EngineContext.Current.Resolve<CAF.Infrastructure.Core.Domain.Common.AdminAreaSettings>().GridPageSize;

    //page title
    ViewBag.Title = T("Admin.ArticleCategory.ArticleTags").Text;
    var g = Html.GridToolKit();
    var grid = g.DataGrid("tagGrid", g.Param(x => x.Id)).TableId("table-id").GridKey("Id").Pager(true)
    .MainGrid(
    g.GridColumn(x => x.Name, 300),
    g.GridColumn(x => x.ArticleCount, 300),
    g.GridColumn("operation", "" + T("Admin.Common.Operation").Text + "", 150).DefaultContent("<a onclick='javascript:OpenWindow(\"" + @Url.Content("~/Admin/Article/EditArticleTag/") + "#Id#?btnId=btnRefresh&formId=Article-tags-form\", 850, 250, true); return false;'  class='btn default btn-xs purple'><i class='fa fa-pencil'></i></a><a href='/Admin/Article/ArticleTagDelete/#Id#' class='btn default btn-xs purple delete'><i class='fa fa-trash-o'></i></a>"))
    .Url(Url.Action("ArticleTags", "Article")).DefaultTableClass();
}
@using System.Linq;
@using (Html.BeginForm(null, null, FormMethod.Post, new { id = "Article-tags-form" }))
{
    <div class="row">
        <div class="col-md-12">
            <div class="portlet light">
                <div class="section-header sticky">
                    <div class="caption">
                        <i class="icon-equalizer font-red-sunglo"></i>
                        <span class="caption-subject font-red-sunglo bold uppercase">@T("Admin.ArticleCategory.ArticleTags")</span>
                        <span class="caption-helper"></span>
                    </div>

                    <div class="actions">
                        <button id="btnAddNewOption" name="btnAddNewOption" class="btn btn-default"
                                onclick="javascript:OpenWindow('@Url.Content("~/Admin/Article/CreateArticleTag/")?btnId=btnRefresh&formId=Article-tags-form', 850, 250, true); return false;">
                            <i class=" fa fa-plus">
                            </i>&nbsp;@T("Admin.ArticleCategory.ArticleTags.AddNew")
                        </button>
                        <button class="btn btn-default" id="btnRefresh" style="display:none">
                            <i class="fa fa-search"></i>@T("Admin.Common.Search")
                        </button>
                    </div>
                </div>
                <div class="portlet-body flip-scroll">

                    <table id="@grid.GetTableId" class="@grid.GetDefaultTableClass" @Html.Raw(grid.GetFixedLayout ? "style='table-layout:fixed'" : "")>
                        <thead>
                            <tr>
                                @foreach (var column in grid.GetColumns)
                                {
                                    <th class="@column.CssClassHeader">@column.DisplayName</th>

                                }
                            </tr>
                        </thead>
                        <tbody></tbody>
                    </table>
                </div>

            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            @(grid)
            $('#btnRefresh').click(function () {
                //refresh grid
                tagGrid.reload();

                //return false to don't reload a page
                return false;
            });
        });
    </script>
}